package com.ps.context;

public class BaseContext {

    // 定义一个ThreadLocal变量，用于存储当前线程的ID
    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    // 设置当前线程的ID
    public static void setCurrentId(Long id) {
        // 将传入的ID设置到当前线程的ThreadLocal中
        threadLocal.set(id);
    }

    // 获取当前线程的ID
    public static Long getCurrentId() {
        return threadLocal.get();
    }

    // 移除当前线程的ID
    public static void removeCurrentId() {
        // 从ThreadLocal中移除当前线程的ID
        threadLocal.remove();
    }

}
